<template>
  <div class="content" style="padding:0px 15px;">
    <div class="md-layout">
      <query-condi-form :querycondi="querycondi" v-on:clickSearch="doSearch"></query-condi-form>
      <paged-table v-show="searchflg" :range="range" @gopage="getList">
        <md-table v-model="applylist">
          <md-table-row slot="md-table-row" slot-scope="{ item }" v-on:click="gotodetail2(item.applyCd)">
            <md-table-cell md-label="申请编号">{{ item.applycd }}</md-table-cell>
            <md-table-cell md-label="申请方名称">{{ item.customername }}</md-table-cell>
            <md-table-cell md-label="申请状态">{{ item.appstatus }}</md-table-cell>
            <md-table-cell md-label="申请时间">{{ item.applydate }}</md-table-cell>
            <md-table-cell md-label="担当人">{{ item.curruser }}</md-table-cell>
            <md-table-cell md-label="登记证书交接时间">{{ item.carlettergranteddatetime }}</md-table-cell>
          </md-table-row>
        </md-table>
      </paged-table>

    </div>
  </div>
</template>

<script>
import SearchParam from '@/views/Common/SearchParam.vue'
import PagedTable from '@/views/Common/Unit/PagedTable.vue'

export default{
  components: {
    'query-condi-form': SearchParam,
    'paged-table': PagedTable
  },

  data () {
    return {
      searchflg: false,
      // 查询条件
      querycondi: {},
      // 查询范围
      range: {},
      applylist: [] // 查询结果
    }
  },
  methods: {
    // 检索
    doSearch: function () {
      // 重置范围
      this.range = {count: 0, curpage: 1, from: 0, pagesize: window.cango.records_per_page}
      this.getList()
    },

    getList: function () {
      this.searchflg = true
      console.log(this.querycondi.appStatusDetail)
      var param = Object.assign(this.querycondi, this.range)
      window.common.searchApply(param).then(data => {
        this.applylist = data.applylist
        this.range.count = data.count
      })
    },

    // 跳转明细
    gotodetail2 (applycd) {
      // alert(applycd)
      this.$router.push({path: '/applyinfo/' + applycd})
    }
  }
}
</script>
